package com.mujin.keji.collectionsystem.module.mypager.viewmodel;

import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.ViewModel;

import com.mujin.keji.collectionsystem.base.BaseDto;
import com.mujin.keji.collectionsystem.base.BaseVo;
import com.mujin.keji.collectionsystem.module.mypager.dto.LogoutDto;
import com.mujin.keji.collectionsystem.module.mypager.dto.UpdatePwdDto;
import com.mujin.keji.collectionsystem.module.mypager.repository.ILogoutRepository;
import com.mujin.keji.collectionsystem.module.mypager.repository.IUpdatePwdRepository;
import com.mujin.keji.collectionsystem.module.mypager.repository.LogoutRepository;
import com.mujin.keji.collectionsystem.module.mypager.repository.UpdatePwdRepository;
import com.mujin.keji.collectionsystem.module.mypager.vo.UpdatePwdVo;
import com.mujin.keji.collectionsystem.module.updata.vo.UploadVo;

/**
 * 退出登录viewmodel
 *
 * @author weishixiong
 * @Time 2018-04-27
 */
public class UpdatePwdViewModel extends ViewModel {
    private LiveData<BaseDto<UpdatePwdDto>> liveData;
    private IUpdatePwdRepository updatePwdRepository;

    public LiveData<BaseDto<UpdatePwdDto>> getLiveData(String newPassword, String password) {
        changePwd(newPassword, password);
        return liveData;
    }

    /**
     * 退出登录
     */
    private void changePwd(String newPassword, String password) {
        UpdatePwdVo vo = new UpdatePwdVo(newPassword, password);
        updatePwdRepository = new UpdatePwdRepository();
        this.liveData = updatePwdRepository.changeUserPassword(vo);
    }


}
